/**
 *  路由懒加载
 *  定义：懒加载也叫延迟加载，即在需要的时候进行加载，随用随载。从而提升了系统性能。
 *
 */
const My = r => require.ensure([], () => r(require('@/views/my/my.vue')), 'my')
const Chat = r => require.ensure([], () => r(require('@/views/chat/chat.vue')), 'chat')
const Home = r => require.ensure([], () => r(require('@/views/home/home.vue')), 'home')
const Shopping = r => require.ensure([], () => r(require('@/views/shopping/shopping.vue')), 'shopping')
const Details = r => require.ensure([], () => r(require('@/views/details/details.vue')), 'details')

const NoPage = r => require.ensure([], () => r(require('@/views/no-page/no-page.vue')), 'noPage')

// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
export default [
    {
        path: '/',
        name: 'home',
        component: Home
    }, {
        path: '/home',
        name: 'home',
        component: Home,
        children: [{
            path: '/details',
            name: 'details',
            component: Details
        }]
    },
    {
        path: '/my',
        name: 'my',
        component: My
    },
    {
        path: '/chat',
        name: 'chat',
        component: Chat
    },
    {
        path: '/shopping',
        name: 'shopping',
        component: Shopping
    },
    {
        path: '*',
        name: '404',
        component: NoPage
    }
]
